﻿using System;
using UnityEngine;
using UnityEngine.UI;

namespace H
{
	// Token: 0x02000210 RID: 528
	internal class HitArea
	{
		// Token: 0x06000E7C RID: 3708 RVA: 0x0005AABC File Offset: 0x00058CBC
		public HitArea(Image image, RectTransform area)
		{
			this.showImg = image;
			this.area = area;
			this.showImg.enabled = false;
			this.Enable = false;
		}

		// Token: 0x17000174 RID: 372
		// (get) Token: 0x06000E7D RID: 3709 RVA: 0x0005AAFC File Offset: 0x00058CFC
		// (set) Token: 0x06000E7E RID: 3710 RVA: 0x0005AB04 File Offset: 0x00058D04
		public bool Enable { get; private set; }

		// Token: 0x06000E7F RID: 3711 RVA: 0x0005AB10 File Offset: 0x00058D10
		public void Setup(bool enable)
		{
			this.Enable = enable;
			if (this.Enable)
			{
				this.center.x = UnityEngine.Random.Range(-1f, 1f);
				this.center.y = UnityEngine.Random.Range(-1f, 1f);
				this.size = UnityEngine.Random.Range(0.5f, 1f);
				this.showImg.rectTransform.anchoredPosition = this.center * this.area.rect.xMax;
				float d = this.size * this.area.rect.xMax * 2f;
				this.showImg.rectTransform.sizeDelta = Vector2.one * d;
			}
		}

		// Token: 0x06000E80 RID: 3712 RVA: 0x0005ABE4 File Offset: 0x00058DE4
		public bool Check(Vector2 pos)
		{
			return this.Enable && Vector2.Distance(this.center, pos) <= this.size;
		}

		// Token: 0x06000E81 RID: 3713 RVA: 0x0005AC0C File Offset: 0x00058E0C
		public void SetShow(bool show)
		{
			this.showImg.enabled = (this.Enable && show);
		}

		// Token: 0x04000EEC RID: 3820
		private Image showImg;

		// Token: 0x04000EED RID: 3821
		private RectTransform area;

		// Token: 0x04000EEE RID: 3822
		public Vector2 center = Vector2.zero;

		// Token: 0x04000EEF RID: 3823
		public float size = 1f;
	}
}
